/*

  author : Harjeet
 * last modified : 12-10-2012   
  
  */

package genRandom;

public class GenerateRandomString {
    
   private static final String ALPHA_NUM =  
           "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";  
   public String getstring() {  
      GenerateRandomString grs = new GenerateRandomString();  
     // System.out.println(grs.getAlphaNumeric(5));  
      String s1=grs.getAlphaNumeric(10);
      //System.out.println(grs.getAlphaNumeric(20));  
      return (s1);
   }  
   public String getAlphaNumeric(int len) {  
      StringBuffer sb = new StringBuffer(len);  
      for (int i=0;  i<len;  i++) {  
         int ndx = (int)(Math.random()*ALPHA_NUM.length());  
         sb.append(ALPHA_NUM.charAt(ndx));  
      }  
      return sb.toString();  
   }  
} 

